{include file="public/header" /}

<article class="page-container">
    <form action="" method="post" class="form form-horizontal" enctype="multipart/form-data" id="form-add">
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">打款usdt：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" placeholder="" value="{$data.usdt|default=''}"  readonly disabled>
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">充值类型：</label>
            <div class="formControls col-xs-8 col-sm-9">
                {switch name="$data.type"}
                {case value="1"}
                <input type="text" class="input-text" placeholder="" value="MT"readonly disabled>
                {/case}
                {case value="2"}
                <input type="text" class="input-text" placeholder="" value="兑换券" readonly disabled>
                {/case}
                {default /}--
                {/switch}
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">兑换数量：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" placeholder="" value="{$data.num|default=''}" name="num" readonly disabled>
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">usdt兑换汇率：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" placeholder="" value="{$data.rate|default=''}"  readonly disabled>
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">用户信息：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" placeholder="" value="用户id：{$data.uid|default=''}-用户账号：{$data.username|default=''}--用户申请时的等级{$data.level|default=''}"  readonly disabled>
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">用户等级折扣率：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" placeholder="" value="{$data.discount|default=''}"  readonly disabled>
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">用户等级折扣率：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <span   class="btn btn-link"  href="javascript:;" onclick="layopen('支付凭证','{:url('user/imageshow',['src'=>$data.img_url])}')">支付凭证</span>
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">设置到账数量：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="number" class="input-text" placeholder="" value="{$data.num|default=''}"  name="to_num" >
            </div>
        </div>


        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">备注：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" placeholder="" value="{$data.mark|default=''}"  name="mark" maxlength="100" >
            </div>
        </div>
        {if  $data.status== 1}
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">请选择审批：</label>
            <span class="select-box " style="width: 200px;margin-left: 15px">
                    <select name="status" class="select">
                        <option value="">请选择审批</option>
                        <option value="2"> 审批成功 </option>
                        <option value="3">审批失败</option>
                    </select>
                </span>
        </div>
        <div class="row cl" style="width: 100%">
            <div style="width: 100%;text-align: center">
                <input type="hidden" value="{$data.id|default=''}" name="id">
                <input class="btn btn-primary radius" type="submit" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
            </div>
        </div>
        {else}
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">审批结果：</label>
            <div class="formControls col-xs-8 col-sm-9">
                {switch name="$data.status"}
                {case value="2"}
                <input type="text" class="input-text" placeholder="" value="审批成功"readonly disabled>
                {/case}
                {case value="3"}
                <input type="text" class="input-text" placeholder="" value="审批失败" readonly disabled>
                {/case}
                {default /}--
                {/switch}
            </div>
        </div>
        {/if}

    </form>
</article>

<!--我在这做了修改，给了一个name属性，方便后端接收值-->

{include file="public/footer" /}
<script>
    $("#form-add").validate({
        rules: {
            type: {
                required: true,
            },
        },
        onkeyup: false,
        focusCleanup: true,
        success: "valid",
        submitHandler: function (form) {
            $(form).ajaxSubmit({
                success: function (data) {
                    console.log(data);
                    if (data.status == 'y') {
                        layer.msg("操作成功", {icon: 1, time: 1000, shade: [0.3, '#000']}, function () {
                            var index = parent.layer.getFrameIndex(window.name);
                            parent.location.reload();
                            parent.layer.close(index);
                        });
                    } else {
                        layer.msg(data.info, {icon: 2, time: 1000, shade: [0.3, '#000']});
                    }
                },
                error: function (error) {
                    layer.msg('系统发生了错误', {icon: 2, time: 3000, shade: [0.5, '#FF0000']});
                }
            });

        }
    });
</script>
